package cn.itsource.crm.service.impl;

import cn.itsource.crm.domain.Customer;
import cn.itsource.crm.mapper.BaseMapper;
import cn.itsource.crm.mapper.CustomerMapper;
import cn.itsource.crm.query.BaseQuery;
import cn.itsource.crm.service.ICustomerService;
import cn.itsource.util.PageList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomerServiceImpl extends BaseServiceImpl<Customer> implements ICustomerService {
    @Autowired
    private CustomerMapper customerMapper;

    @Override
    public PageList queryPage1(BaseQuery baseQuery) {
        PageList pageList = new PageList();
        //总数 select count(*) from xxx where ?
        Long total =  customerMapper.queryTotal(baseQuery);
        //select * from xxx where xxx limit
        List rows =  customerMapper.queryData1(baseQuery);
        pageList.setTotal(total);
        pageList.setRows(rows);
        return pageList;
    }
}
